package obj;

import UI.control;

import javax.swing.*;
/**
 * 工具物品类
 * 攻击伤害是否消失
 * 移动
 */

public class drops implements objs{
    public int x;
    public int y;
    private ImageIcon img;
    private int speed;
    public  int wid;
    public int hei;
    private int harms;//伤害
    public drops(int x, int y, int speed, int harms){
        this.x=x;
        this.y=y;
        this.speed=speed;
        this.wid=40;
        this.hei=40;
        this.img=new ImageIcon("E:\\java\\month3-game\\resource\\firedown.png");
        this.harms=harms;
    }
    public drops(int x, int y, int speed, int harms,String path){
        //用户发射
        this.x=x;
        this.y=y;
        this.speed=speed;
        this.wid=40;
        this.hei=40;
        this.img=new ImageIcon(path);
        this.harms=harms;
    }

    @Override
    public ImageIcon GetImg() {
        return this.img;
    }

    @Override
    public int Getx() {
        return this.x;
    }

    @Override
    public int Gety() {
        return this.y;
    }

    @Override
    public int getspeed() {
        return this.speed;
    }
    public int GetHarm(){
        return this.harms;
    }
    public boolean move(int dx,int dy) {
        if (x + dx < control.heigth && x >= 0) {
            this.x += dx;
            if (y + dy < control.width - 100 && y >= 0) {
                this.y += dy;
                return true;
            }
        }
        return false;
    }

    @Override
    public int GetWid() {
        return this.wid;
    }

    @Override
    public int GetHei() {
        return this.hei;
    }
    public int Gethame(){
        return this.harms;
    }
}
